Riemann sum

Topics in Calculus
Fundamental theorem
Limits of functions
Continuity
Mean value theorem

In mathematics, a Riemann sum is a method for approximating the total area underneath a curve on a graph, otherwise known as an integral. It may also be used to define the integration operation. The method was named after German mathematician Bernhard Riemann.

Contents

Definition

Let f: DR be a function defined on a subset D of the real line R. Let I = [a, b] be a closed interval contained in D, and let P = {[x0, x1), [x1, x2), ... [xn-1, xn]} be a partition of I, where a = x0 < x1 < x2 ... < xn = b.

The Riemann sum of f over I with partition P is defined as

S = \sum_{i=1}^{n} f(x^*_i)(x_{i}-x_{i-1})

where xi-1x*i xi. The choice of x*i in this interval is arbitrary. If x*i = xi-1 for all i, then S is called a left Riemann sum. If x*i = xi, then S is called a right Riemann sum. If x*i = (xi+xi-1)/2, then S is called a middle Riemann sum. The average of the left and right Riemann sum is the trapezoidal sum.

If it is given that

S = \sum_{i=1}^{n} v_i(x_{i}-x_{i-1})

where vi is the supremum of f over [xi-1, xi], then S is defined to be an upper Riemann sum. Similarly, if vi is the infimum of f over [xi−1, xi], then S is a lower Riemann sum.

Any Riemann sum on a given partition (that is, for any choice of x*i between xi-1 and xi) is contained between the lower and the upper Riemann sums. A function is defined to be Riemann integrable if the lower and upper Riemann sums get ever closer as the partition gets finer and finer. This fact can also be used for numerical integration.

Methods

Riemann sum methods of x3 over [0,2] using 4 subdivisions

Left
Right
Middle
Trapezoidal
Simpson's Method

The four methods of Riemann summation are usually best approached with partitions of equal size. The interval [a,b] is therefore divided into n subintervals, each of length \Delta x = (b-a)/n. The points in the partition will then be

a, a %2B \Delta x, a %2B 2 \Delta x, \ldots, a %2B (n-2) \Delta x, a %2B (n-1) \Delta x, b .

Left sum

For the left Riemann sum, approximating the function by its value at the left-end point gives multiple rectangles with base Δx and height f(a + iΔx). Doing this for i = 0, 1, ..., n−1, and adding up the resulting areas gives

\Delta x \left[f(a) %2B f(a %2B \Delta x) %2B f(a %2B 2 \Delta x)%2B\cdots%2Bf(b - \Delta x)\right].\,

The left Riemann sum amounts to an overestimation if f is monotonically decreasing on this interval, and an underestimation if it is monotonically increasing.

Right sum

f is here approximated by the value at the right endpoint. This gives multiple rectangles with base Δx and height f( a %2B i \Delta x ). Doing this for i = 1, 2, \ldots, n-1, n, and adding up the resulting areas produces

\Delta x \left[ f( a %2B \Delta x ) %2B f(a %2B 2 \Delta x)%2B\cdots%2Bf(b) \right].\,

The right Riemann sum amounts to an overestimation if f is monotonically increasing, and an underestimation if it is monotonically decreasing.

Middle sum

Approximating f at the midpoint of intervals gives f(a + Q/2) for the first interval, for the next one f(a + 3Q/2), and so on until f(b-Q/2). Summing up the areas gives

Q\left[f(a %2B Q/2) %2B f(a %2B 3Q/2)%2B\cdots%2Bf(b-Q/2)\right].

The error of this formula will be

\left \vert \int_{a}^{b} f(x) \, dx - A_\mathrm{mid} \right \vert \le \frac{M_2(b-a)^3}{(24n^2)},

where M_2 is the maximum value of the absolute value of f^{\prime\prime}(x) on the interval.

Trapezoidal rule

In this case, the values of the function f on an interval are approximated by the average of the values at the left and right endpoints. In the same manner as above, a simple calculation using the area formula A=h(b_1%2Bb_2)/2 for a trapezium with parallel sides b1, b2 and height h produces

\frac{1}{2}Q\left[f(a) %2B 2f(a%2BQ) %2B 2f(a%2B2Q) %2B 2f(a%2B3Q)%2B\cdots%2Bf(b)\right].
\left \vert \int_{a}^{b} f(x) \, dx - A_\mathrm{trap} \right \vert \le \frac{M_2(b-a)^3}{(12n^2)},

where M_2 is the maximum value of the absolute value of f^{\prime\prime}(x).

Examples

Example

Taking an example, the area under the curve of x^2 between 0 and 2 can be procedurally computed using Riemann's method.

The interval from 0 to 2 is firstly divided into n subintervals, each of which is given a width of \frac{2}{n}; these are the widths of the Riemann rectangles. Because the right Riemann sum is to be used, the sequence of x coordinates for the boxes will be x_1, x_2, \ldots, x_n. Therefore, the sequence of the heights of the boxes will be (x_1)^2, (x_2)^2, (x_3)^2, \ldots, (x_n)^2. It is an important fact that x_i = \frac{2i}{n}, and x_n = 2.

The area of each box will be \frac{2}{n} \times (x_i)^2 and therefore the nth right Riemann sum will be:S = \frac{2}{n} \times \left(\frac{2}{n}\right)^2 %2B \cdots %2B \frac{2}{n} \times \left(\frac{2i}{n}\right)^2 %2B \cdots %2B \frac{2}{n} \times \left(2\right)^2. Hence:

S = \frac{8}{n^3} \left(1 %2B \cdots %2B i^2 %2B \cdots %2B n^2\right)
S = \frac{8}{n^3} \left(\frac{n(n%2B1)(2n%2B1)}{6}\right)
S = \frac{8}{n^3} \left(\frac{2n^3%2B3n^2%2Bn}{6}\right)
S = \frac{8}{3} %2B \frac{4}{n} %2B \frac{4}{3n^2}

If the limit is viewed as n \rightarrow \infty, it can be concluded that the approximation approaches the actual value of the area under the curve as the number of boxes increases. Hence:

S = \lim_{n \rightarrow \infty}\left(\frac{8}{3} %2B \frac{4}{n} %2B \frac{4}{3n^2}\right)
S = \frac{8}{3}

This method agrees with the definite integral as calculated in more mechanical ways:

\int_0^2 x^2\,  dx = \frac{8}{3}.

Animations

See also

References

External links